//----------------------------------------------------------------------------
// M A R I T I M E  R E S E A R C H  I N S T I T U T E  N E T H E R L A N D S
//----------------------------------------------------------------------------
// Copyright (C) 2008 - MARIN - All rights reserved - http://www.marin.nl
//----------------------------------------------------------------------------
// Program    : mermaid
// Module     : vbm
// File       : Solver.h
//----------------------------------------------------------------------------

#ifndef SOLVER_H
#define SOLVER_H

#include "defines.h" // REAL
//#include "Array1D.h"
#include "Array2D.h"

#ifdef EWLAPACK
#include <lapackpp.h> // Lapack++ library // see NopDefSolver.cpp
#include <sybmd.h> // for LaSymmBandMatdouble
#endif

/// base class for solvers
class Solver
{
public:

    Solver(int Nx1, int Nx2, REAL tolerance);

    virtual ~Solver();

    /// should be overloaded to really solve something
    virtual void solve(Array2D<REAL> *pB,
                       Array2D<REAL> *pX) = 0;

protected:

    int m_Nx1; // Number of nodes in the x1-direction, except ghost points.
    int m_Nx2; // Number of nodes in the x1-direction, except ghost points.
    REAL m_tolerance; // Tolerance of CG-method.

#ifdef EWLAPACK
    // A Lapack++ routine for solving a linear system with spd matrix.
    void LaLinearSolveIPChol(LaSymmBandMatDouble &A,
                             LaGenMatDouble &B);
    // EW: nu is het LaGenMatDouble, maar er wordt een LaVectorDouble gebruikt.
#endif

private:

    /// @cond nevercall
    Solver(const Solver& m);
    Solver & operator =(const Solver& m);
    /// @endcond

};



#endif // SOLVER_H
